package com.mxf.code.entity.relation;

import com.mxf.code.entity.node.Person;
import lombok.Data;
import org.neo4j.ogm.annotation.EndNode;
import org.neo4j.ogm.annotation.RelationshipEntity;
import org.neo4j.ogm.annotation.StartNode;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Property;

import java.io.Serializable;

/**
 * @author 28382
 */
@Data
@RelationshipEntity(type = "FRIEND")
public class PersonRelation implements Serializable {

    @Id
    @GeneratedValue
    private Long id;

    @StartNode
    private Person parent;

    @EndNode
    private Person child;

    @Property("relation")
    private String relation;

    public PersonRelation(Person parent, Person child,String relation) {
        this.parent = parent;
        this.child = child;
        this.relation = relation;
    }
}

